package geography;

/**
 * Possible directions of movement in the maze.
 * @author Nils Klement
 *
 */
public enum Orientation{
	NORTH,
	EAST,
	SOUTH,
	WEST;
	
	/**
	 * Returns the opposite direction of any given {@link Orientation}.
	 * @return {@link Orientation} opposite to the current one.
	 */
	public Orientation getOpposite(){
		switch (this){
			case NORTH:
				return SOUTH;
			case EAST:
				return WEST;
			case SOUTH:
				return NORTH;
			case WEST:
				return EAST;
			default:
				return null;
		}
	}
	
	/**
	 * Returns the horizontal increment or decrement resulting in moving in this direction.
	 * @return {@link Integer} that is either -1, 0 or 1.
	 */
	public int getIncrementX(){
		switch (this){
		case EAST:
			return 1;
		case WEST:
			return -1;
		default:
			return 0;
		}
	}
	
	/**
	 * Returns the vertical increment or decrement resulting in moving in this direction.
	 * @return {@link Integer} that is either -1, 0 or 1.
	 */
	public int getIncrementY(){
		switch (this){
		case NORTH:
			return -1;
		case SOUTH:
			return 1;
		default:
			return 0;
		}
	}
	
	/**
	 * Returns the {@link Orientation} facing left from the current direction.
	 * @return {@link Orientation} going left.
	 */
	public Orientation getLeft(){
		switch (this){
		case NORTH:
			return WEST;
		case EAST:
			return NORTH;
		case SOUTH:
			return EAST;
		case WEST:
			return SOUTH;
		default:
			return null;
		}
	}
	
	/**
	 * Returns the {@link Orientation} facing right from the current direction.
	 * @return {@link Orientation} going right.
	 */
	public Orientation getRight(){
		switch (this){
		case NORTH:
			return WEST;
		case EAST:
			return NORTH;
		case SOUTH:
			return EAST;
		case WEST:
			return SOUTH;
		default:
			return null;
		}
	}
}